
#import "SMMineWalletViewController.h"
@implementation SMMineWalletViewController {
    NSArray *_tx;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"钱包 / 余额";
    self.view.backgroundColor=UIColor.systemGroupedBackgroundColor;
    self.tableView.backgroundColor=UIColor.systemGroupedBackgroundColor;
    self.tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    self.tableView.tableHeaderView = [self header];
    NSMutableArray *arr=[NSMutableArray array];
    for(int i=0;i<20;i++){
        [arr addObject:@{@"title":(arc4random_uniform(2)?@"收款":@"付款"),
                         @"time":@"2025-08-20 12:30",
                         @"amt": (arc4random_uniform(2)?@"+¥560":@"-¥320")}];
    }
    _tx=arr;
}
- (UIView*)header{
    UIView *v=[[UIView alloc] initWithFrame:CGRectMake(0,0,UIScreen.mainScreen.bounds.size.width,140)];
    UILabel *t=[UILabel new]; t.text=@"当前余额"; t.textAlignment=NSTextAlignmentCenter;
    UILabel *b=[UILabel new]; b.text=@"¥ 12,560.00"; b.font=[UIFont systemFontOfSize:28 weight:UIFontWeightBold]; b.textAlignment=NSTextAlignmentCenter;
    [v addSubview:t]; [v addSubview:b];
    t.frame=CGRectMake(0,18,v.bounds.size.width,20);
    b.frame=CGRectMake(0,50,v.bounds.size.width,40);
    return v;
}
- (NSInteger)tableView:(UITableView*)t numberOfRowsInSection:(NSInteger)s{ return _tx.count; }
- (UITableViewCell*)tableView:(UITableView*)t cellForRowAtIndexPath:(NSIndexPath*)i{
    UITableViewCell *c=[t dequeueReusableCellWithIdentifier:@"c"]; if(!c) c=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"c"];
    NSDictionary *d=_tx[i.row]; c.textLabel.text=[NSString stringWithFormat:@"%@ · %@", d[@"title"], d[@"time"]];
    c.detailTextLabel.text=d[@"amt"]; return c;
}
@end
